package com.xingxin.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xingxin.entity.Attribute;
import com.xingxin.service.AttributeService;
import org.apache.catalina.Wrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.List;

import static com.xingxin.controller.StaticTest.findAllFather;

/**
 * <p>
 * 订单表 前端控制器
 * </p>
 *
 * @author mrLiu
 * @since 2021-01-08
 */
@RestController
@RequestMapping("/order")
public class OrderController  extends StaticTest{

//    private static List<Attribute> attributes;
//    @Autowired
//    private AttributeService attributeService;
//    @Autowired
//    private static AttributeService attributeService1;

    @Resource
    private AttributeService attributeService;

    @GetMapping("/test")
    public List<Attribute> findAll(){
        List<Attribute> attributes = findAllFather();
        QueryWrapper<Attribute> wrapper = new QueryWrapper<>();
        Attribute attribute = new Attribute();
        attribute.setAttrId(1);
        wrapper.setEntity(attribute);
        Attribute attributeOne = attributeService.getBaseMapper().selectOne(wrapper);
        System.out.println("attributeOne = " + attributeOne);
        Attribute oneFather = findOneFather();
        System.out.println("oneFather = " + oneFather);
        return attributes;
    }

//    @PostConstruct
//    public void init(){
//        this.attributeService1 = attributeService;
//    }
//
//    public static void find(){
//        attributes = attributeService1.selectAll();
//    }
}

